//
// Created by xqyr on 2025/3/30.
//

#ifndef FSERVICE_FSERVICE_H
#define FSERVICE_FSERVICE_H
#define CONFIG_DEBUG_LOG
#define CONFIG_LOG_TO_STDOUT
#define FDB_LOG_TAG "FDB_TEST_CLIENT"
#include <common_base/fdbus.h>
#include <common_base/CFdbProtoMsgBuilder.h>
#include <common_base/cJSON/cJSON.h>
#include <common_base/CFdbCJsonMsgBuilder.h>

class FClient : public CBaseClient
 {
public:
    explicit FClient(const char *name, CBaseWorker *worker = nullptr);
protected:
    /* called when connected to the server */
    void onOnline(FdbSessionId_t sid, bool is_first) override;

    /* called when disconnected from server */
    void onOffline(FdbSessionId_t sid, bool is_last) override;

    /* called when events broadcasted from server is received */
    void onBroadcast(CBaseJob::Ptr &msg_ref) override;

    /* called when client call asynchronous version of invoke() and reply() is called at server */
    void onReply(CBaseJob::Ptr &msg_ref) override;

    /* check if something happen... */
    void onStatus(CBaseJob::Ptr &msg_ref
            , int32_t error_code
            , const char *description) override;



};


#endif //FSERVICE_FSERVICE_H
